<?php

namespace App\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;

class RoleCreateRequest extends FormRequest
{

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            "name"=>"required|unique:roles,name",
            "display_name"=>"required|unique:roles,display_name"
        ];
    }

    public function messages()
    {
        return [
            "name.required"=>"不能为空",
            "name.unique"=>"重复了",
            "display_name.required"=>"不能为空",
            "display_name.unique"=>"重复了"
        ];
    }
}
